# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=subterfuge
pkgver=64.69dda99
pkgrel=3
epoch=2
groups=('blackarch' 'blackarch-exploitation')
pkgdesc='Automated Man-in-the-Middle Attack Framework.'
url='https://github.com/Subterfuge-Framework/Subterfuge'
arch=('any')
license=('GPL3')
depends=('python2' 'python2-django' 'python2-configparser')
makedepends=('git')
source=("$pkgname::git+https://github.com/Subterfuge-Framework/Subterfuge.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/licenses/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat >> "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

